package com.weiz.designpatterns.chainofresponsibility;

public class ChainTest {
    public static void main(String[] args) {
        LeaveRequestHandler supervisor = new Supervisor();
        LeaveRequestHandler manager = new Manager();
        LeaveRequestHandler director = new Director();
        // 设置调用联调
        supervisor.setNextHandler(manager);
        manager.setNextHandler(director);

        LeaveRequest request1 = new LeaveRequest(2);
        supervisor.handleRequest(request1);

        LeaveRequest request2 = new LeaveRequest(8);
        supervisor.handleRequest(request2);

        LeaveRequest request3 = new LeaveRequest(15);
        supervisor.handleRequest(request3);

        LeaveRequest request4 = new LeaveRequest(35);
        supervisor.handleRequest(request4);
    }
}
